GraphDraw

Data input


[ Data input | Input window menu | Keyboard shortcuts and special keys ]

[ Full index ]


Data input and edit

Clicking with SELECT on the iconbar icon, or on the New option in the iconbar menu, will open a new data input window. GraphDraw can have several of these windows active at any one time. The window is shown below.

The window as opened will have two columns for the x and y values. Clicking the mouse in an appropriate cell will set the caret ready for text input. Tab will move from one cell to the next. Return will do the same, but in addition, when in the rightmost cell, a new row will be added when Return is pressed. The result of entering data may be as shown below.

For general editing of the data most of the expected special keypresses for navigation, etc., are available. To clear a cell, use Ctrl-U. To delete a complete row, use Ctrl-Shift-Delete. To insert a new blank row, use Ctrl-Shift-Insert. The full set of keypresses are described below.

Loading data

Double clicking a previously saved data file will load it into a new data input window (assuming the limit of open windows has not been reached). A previously saved data file may also be dragged to the iconbar icon, whereupon the data will be loaded into a new input window.

The behaviour on dragging a file into an already open edit window depends upon whether you have the option "Drag to edit window appends data" ticked. This option can be found in Choices... from the iconbar menu. If the option is ticked (selected) then dragging a data file to the edit window will add the data to that which is already present. This allows you to combine two or more sets of data into one dataset. If the option is not ticked, then the new data will be loaded into a new input window as above.

Other data formats

!GraphDraw can load files of comma, TAB, or space separated ASCII data, as long as the filetype is either text, data, or CSV, and so it is possible to set up other applications to produce data files of the correct form. Contact the author if you need any advice on integrating your own applications with GraphDraw or MultiPlot.


Input window menu

The menu attached to the data input window is shown to the right.

Save as
This leads, via a submenu offering the save either in GraphDraw or CSV format, to a standard 'save as' dialogue box. Drag the icon to a filer window, or a suitable application, or enter the path manually to complete the save.

Once a GraphDraw data file has been saved, then double clicking on it in a filer window will reload it in to GraphDraw. If the application has been seen by the filer, or been filer_booted, then GraphDraw will be launched if not already running. The saved data file can also be reloaded into GraphDraw by dragging its file icon from a filer window to the iconbar icon.


Plot points, Join points
Clicking on these options will simply plot a scaled graph of the data using linear x axis and y axis scales. Following the submenu allows you to plot the data on semi-log or log-log axes, as well as linear axes. If the data contains values that are zero or negative, and you attempt to use a logarithmic axis, then an error message will be displayed, and only the normal plot will be allowed.

In the case of joined points, each point is joined to the next point by a straight line. While this is not the usual "scientific" way of doing things, it can be useful under certain circumstances.


Least squares fit
This will carry out a standard linear regression by the least squares method to calculate the best fit straight line through the data. A window will open displaying the slope, intercept on y axis, correlation coefficient and the standard errors of the slope and intercept.

A submenu is also available which allows the further options of

  • Force line through the origin
  • Semi-log x
  • Semi-log y
  • Log x - log y

In the latter cases, an error will be generated if one or more of the values to be logged is zero or negative.

When the chosen fit has been completed, a window will open in which is shown the results of the fitting procedure.

Parabola
This will carry out a least squares fit of the data to the equation of a parabola

y = u + vx + wx2

This is a useful technique for fitting data to a simple curve. A window will open showing the calculated values of the coefficients u, v and w.

Polynomial
Clicking on this item will carry out a standard polynomial fit for orders 2 to 6, and choose the best fit.

y = a + bx + cx2
y = a + bx + cx2 + dx3
y = a + bx + cx2 + dx3 + ex4
y = a + bx + cx2 + dx3 + ex4 + fx5
y = a + bx + cx2 + dx3 + ex4 + fx5 + gx6

It also leads to a submenu which allows you to select a particular order to force the program to calculate that specific order polynomial. The option 'All' is also available, which has the same action as selecting the polynomial option in the root menu, i.e. the program will try all possible orders (2 to 6) and report the one which gives the smallest deviation. Some of the higher order options may be greyed out if there are not enough data points to allow the fit to be calculated. A scrollable window will open showing the results of the calculation.

Cubic spline
This option leads to a writable icon which allows you to specify the closeness of fit of the cubic spline to the data points.

A value of almost 1.0 (e.g. 0.9999) will try to force the line to pass through every point. A very small value, e.g. 0.0001, will produce something approaching a straight line through the data points. Note that the program will not allow you to enter a value of exactly 0.0 or 1.0, since this would create a "divide by zero error" during the calculation. Pressing the RETURN key or clicking on the Calculate button will carry out the calculation and a graph window will open to display a graph of the cubic spline curve through the data points. For this plot, it requires the data to be sorted in increasing order of x. The program automatically sorts the data in ascending order of x values before carrying out the spline routine (note that it will not change the order of the data in the data edit window).

Transform X, Transform Y
A number of common transformations can be carried out on either the x or the y values of the data independently. Both these options lead to a sub-menu listing the options available. These include LOG, LN, EXP, square, square root, reciprocal, and may change with different versions of this software. The operations are cumulative, but only the last operation can be undone directly. You can, of course, use the corresponding inverse function (if available) to undo an operation, but since these operations are subject to rounding errors, there is no guarantee that the original data will be exactly reproduced.
Swap x and y
Note that when you plot "function 1 against function 2", by convention, function 1 is on the y-axis (vertical) and function 2 is on the x-axis (horizontal). If you get it wrong, use this option to interchange the x and y data!
Sort data
While the Spline routine is the only one to require the data to be sorted in order, and the spline routine sorts the data automatically anyway, this option is perhaps superfluous. However, it is sometimes useful to sort the data (in ascending order on X) before saving for example.

Keyboard shortcuts and special keys

Many of the standard key actions are available in the input window.

Left arrow Move caret left by one character within the current field.
Shift left arrow Move caret to left of data in current cell, unless already at left, when caret moves to previous cell in row.
Control left arrow or Home Move caret to end of data in leftmost cell of current row.
Right arrow Move caret right by one character within the current field.
Shift right arrow Move caret to right of data in current cell, unless already at right, when caret moves to next cell in row.
Control right arrow or End Move caret to end of data in rightmost cell of current row.
Down arrow Move caret down one row.
Up arrow Move caret up one row.
Page down or Shift down arrow Move caret down by 10 lines, or to bottom line if less than ten lines from bottom.
Page up or Shift up arrow Move caret up by 10 lines, or to top line if less than ten lines from top.
Control down arrow Move caret to bottom line.
Control up arrow Move caret to top line.
Tab Move caret to next field. If at end of row, move to left field of next row.
Shift Tab Caret moves to previous cell in row.
Return Move caret to next field. If at end of row, move to left field of next row. If at end of bottom row, create a new row and move to left field.
Control U Clear the contents of the current cell.
Backspace Delete character to left of caret.
Delete Delete character to right of caret.
Control shift Delete Delete the complete row of data and close up the rows.
Control shift Insert Insert a new blank row above the current caret row.

These pages are best viewed in a CSS compliant browser. For RISC OS, Netsurf would be the browser of choice.

Larr.gif - 145 bytes Choices   |   Index  |   Results of fitting Rarr.gif - 141 bytes

GraphDraw is © Chris Johnson, 2014
Email:chris@chris-johnson.org.uk

This document last modified on 15th August 2015